import store from "../store"
import { useRouter } from "vue-router"
export default {
  setup() {
    const router = useRouter()
    // 保存后关闭新增或修改页面返回到前一页
    const returnRoute = () => {
      const { to, from } = store.getters.toFromRouter
      const toFullPath = to.fullPath
      const fromQuery= from.query
      const fromParams= from.params
      const fromPath = from.path
      store.dispatch('layout/removeTabNext', toFullPath)
      router.push({
        path: fromPath,
        query: fromQuery,
        params: fromParams
      })
    }
    return {
      returnRoute
    }
  }
}